﻿using System;
using System.Data;
using System.Text;
using System.Collections.Generic;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Data.Sql;
using System.Data.Common;

namespace Chenxin.Lib.Business.DAL
{
    /// <summary>
    /// 数据访问类IntentionBaseInfo。
    /// </summary>
    public class IntentionBaseInfo
    {
        public IntentionBaseInfo()
        { }
        #region  成员方法

        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public static bool Exists(Guid IntentionId)
        {
            Database db = DatabaseFactory.CreateDatabase("Chenxin_Business");
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) from t_Intention_BaseInfo where IntentionId=@IntentionId ");
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "IntentionId", DbType.Guid, IntentionId);
            int cmdresult;
            object obj = db.ExecuteScalar(dbCommand);
            if ((Object.Equals(obj, null)) || (Object.Equals(obj, System.DBNull.Value)))
            {
                cmdresult = 0;
            }
            else
            {
                cmdresult = int.Parse(obj.ToString());
            }
            if (cmdresult == 0)
            {
                return false;
            }
            else
            {
                return true;
            }
        }


        /// <summary>
        /// 增加一条数据
        /// </summary>
        public static void Add(Chenxin.Lib.Business.Entity.IntentionBaseInfo model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into t_Intention_BaseInfo(");
            strSql.Append("IntentionId,bContracted,ContractId,ContractCode,IntentionCode,CreateDate,CreateEmpId,CreateEmp,BelongCityId,BelongCityName,BelongCompanyId,BelongCompany,BelongDepartId,BelongDepart,BelongEmpId,BelongEmp,DeliverTime,LastEmployeeId,LastEmployee,LastEmployeeGetTime,BusinessType,IntentionType,UpdateEmpId,UpdateEmp,UpdateTime,Status,StatusDescription,HouseId,HouseCode,HouseAddress,Region,TotalPrice,CustomerName_Sale,CustomerName_Buy,FirstMoney,TotalMoney,GetedMoney,DeliveredMoney,LastContractDate,LastDeliverMoneyDate,DeliverTo,LostItems,GetAuthorizeDate,ChangeTime)");

            strSql.Append(" values (");
            strSql.Append("@IntentionId,@bContracted,@ContractId,@ContractCode,@IntentionCode,@CreateDate,@CreateEmpId,@CreateEmp,@BelongCityId,@BelongCityName,@BelongCompanyId,@BelongCompany,@BelongDepartId,@BelongDepart,@BelongEmpId,@BelongEmp,@DeliverTime,@LastEmployeeId,@LastEmployee,@LastEmployeeGetTime,@BusinessType,@IntentionType,@UpdateEmpId,@UpdateEmp,@UpdateTime,@Status,@StatusDescription,@HouseId,@HouseCode,@HouseAddress,@Region,@TotalPrice,@CustomerName_Sale,@CustomerName_Buy,@FirstMoney,@TotalMoney,@GetedMoney,@DeliveredMoney,@LastContractDate,@LastDeliverMoneyDate,@DeliverTo,@LostItems,@GetAuthorizeDate,@ChangeTime)");
            Database db = DatabaseFactory.CreateDatabase("Chenxin_Business");
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "IntentionId", DbType.Guid, model.IntentionId);
            db.AddInParameter(dbCommand, "bContracted", DbType.Boolean, model.bContracted);
            db.AddInParameter(dbCommand, "ContractId", DbType.Guid, model.ContractId);
            db.AddInParameter(dbCommand, "ContractCode", DbType.AnsiString, model.ContractCode);
            db.AddInParameter(dbCommand, "IntentionCode", DbType.AnsiString, model.IntentionCode);
            db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, model.CreateDate);
            db.AddInParameter(dbCommand, "CreateEmpId", DbType.Guid, model.CreateEmpId);
            db.AddInParameter(dbCommand, "CreateEmp", DbType.AnsiString, model.CreateEmp);
            db.AddInParameter(dbCommand, "BelongCityId", DbType.Guid, model.BelongCityId);
            db.AddInParameter(dbCommand, "BelongCityName", DbType.AnsiString, model.BelongCityName);
            db.AddInParameter(dbCommand, "BelongCompanyId", DbType.Guid, model.BelongCompanyId);
            db.AddInParameter(dbCommand, "BelongCompany", DbType.AnsiString, model.BelongCompany);
            db.AddInParameter(dbCommand, "BelongDepartId", DbType.Guid, model.BelongDepartId);
            db.AddInParameter(dbCommand, "BelongDepart", DbType.AnsiString, model.BelongDepart);
            db.AddInParameter(dbCommand, "BelongEmpId", DbType.Guid, model.BelongEmpId);
            db.AddInParameter(dbCommand, "BelongEmp", DbType.AnsiString, model.BelongEmp);
            db.AddInParameter(dbCommand, "DeliverTime", DbType.DateTime, model.DeliverTime);
            db.AddInParameter(dbCommand, "LastEmployeeId", DbType.Guid, model.LastEmployeeId);
            db.AddInParameter(dbCommand, "LastEmployee", DbType.AnsiString, model.LastEmployee);
            db.AddInParameter(dbCommand, "LastEmployeeGetTime", DbType.DateTime, model.LastEmployeeGetTime);
            db.AddInParameter(dbCommand, "BusinessType", DbType.Int32, model.BusinessType);
            db.AddInParameter(dbCommand, "IntentionType", DbType.Int32, model.IntentionType);
            db.AddInParameter(dbCommand, "UpdateEmpId", DbType.Guid, model.UpdateEmpId);
            db.AddInParameter(dbCommand, "UpdateEmp", DbType.AnsiString, model.UpdateEmp);
            db.AddInParameter(dbCommand, "UpdateTime", DbType.DateTime, model.UpdateTime);
            db.AddInParameter(dbCommand, "Status", DbType.Int32, model.Status);
            db.AddInParameter(dbCommand, "StatusDescription", DbType.AnsiString, model.StatusDescription);
            db.AddInParameter(dbCommand, "HouseId", DbType.Guid, model.HouseId);
            db.AddInParameter(dbCommand, "HouseCode", DbType.AnsiString, model.HouseCode);
            db.AddInParameter(dbCommand, "HouseAddress", DbType.AnsiString, model.HouseAddress);
            db.AddInParameter(dbCommand, "Region", DbType.AnsiString, model.Region);
            db.AddInParameter(dbCommand, "TotalPrice", DbType.Decimal, model.TotalPrice);
            db.AddInParameter(dbCommand, "CustomerName_Sale", DbType.AnsiString, model.CustomerName_Sale);
            db.AddInParameter(dbCommand, "CustomerName_Buy", DbType.AnsiString, model.CustomerName_Buy);
            db.AddInParameter(dbCommand, "FirstMoney", DbType.Decimal, model.FirstMoney);
            db.AddInParameter(dbCommand, "TotalMoney", DbType.Decimal, model.TotalMoney);
            db.AddInParameter(dbCommand, "GetedMoney", DbType.Decimal, model.GetedMoney);
            db.AddInParameter(dbCommand, "DeliveredMoney", DbType.Decimal, model.DeliveredMoney);
            db.AddInParameter(dbCommand, "LastContractDate", DbType.DateTime, model.LastContractDate);
            db.AddInParameter(dbCommand, "LastDeliverMoneyDate", DbType.DateTime, model.LastDeliverMoneyDate);
            db.AddInParameter(dbCommand, "DeliverTo", DbType.Int32, model.DeliverTo);
            db.AddInParameter(dbCommand, "LostItems", DbType.AnsiString, model.LostItems);
            db.AddInParameter(dbCommand, "GetAuthorizeDate", DbType.DateTime, model.GetAuthorizeDate);
            db.AddInParameter(dbCommand, "ChangeTime", DbType.DateTime, model.ChangeTime);
            db.ExecuteNonQuery(dbCommand);
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public static void Update(Chenxin.Lib.Business.Entity.IntentionBaseInfo model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update t_Intention_BaseInfo set ");
            strSql.Append("bContracted=@bContracted,");
            strSql.Append("ContractId=@ContractId,");
            strSql.Append("ContractCode=@ContractCode,");
            strSql.Append("IntentionCode=@IntentionCode,");
            strSql.Append("CreateDate=@CreateDate,");
            strSql.Append("CreateEmpId=@CreateEmpId,");
            strSql.Append("CreateEmp=@CreateEmp,");
            strSql.Append("BelongCityId=@BelongCityId,");
            strSql.Append("BelongCityName=@BelongCityName,");
            strSql.Append("BelongCompanyId=@BelongCompanyId,");
            strSql.Append("BelongCompany=@BelongCompany,");
            strSql.Append("BelongDepartId=@BelongDepartId,");
            strSql.Append("BelongDepart=@BelongDepart,");
            strSql.Append("BelongEmpId=@BelongEmpId,");
            strSql.Append("BelongEmp=@BelongEmp,");
            strSql.Append("DeliverTime=@DeliverTime,");
            strSql.Append("LastEmployeeId=@LastEmployeeId,");
            strSql.Append("LastEmployee=@LastEmployee,");
            strSql.Append("LastEmployeeGetTime=@LastEmployeeGetTime,");
            strSql.Append("BusinessType=@BusinessType,");
            strSql.Append("IntentionType=@IntentionType,");
            strSql.Append("UpdateEmpId=@UpdateEmpId,");
            strSql.Append("UpdateEmp=@UpdateEmp,");
            strSql.Append("UpdateTime=@UpdateTime,");
            strSql.Append("Status=@Status,");
            strSql.Append("StatusDescription=@StatusDescription,");
            strSql.Append("HouseId=@HouseId,");
            strSql.Append("HouseCode=@HouseCode,");
            strSql.Append("HouseAddress=@HouseAddress,");
            strSql.Append("Region=@Region,");
            strSql.Append("TotalPrice=@TotalPrice,");
            strSql.Append("CustomerName_Sale=@CustomerName_Sale,");
            strSql.Append("CustomerName_Buy=@CustomerName_Buy,");
            strSql.Append("FirstMoney=@FirstMoney,");
            strSql.Append("TotalMoney=@TotalMoney,");
            strSql.Append("GetedMoney=@GetedMoney,");
            strSql.Append("DeliveredMoney=@DeliveredMoney,");
            strSql.Append("LastContractDate=@LastContractDate,");
            strSql.Append("LastDeliverMoneyDate=@LastDeliverMoneyDate,");
            strSql.Append("DeliverTo=@DeliverTo,");
            strSql.Append("LostItems=@LostItems,");
            strSql.Append("GetAuthorizeDate=@GetAuthorizeDate,");
            strSql.Append("ChangeTime=@ChangeTime");
            strSql.Append(" where IntentionId=@IntentionId ");
            Database db = DatabaseFactory.CreateDatabase("Chenxin_Business");
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "IntentionId", DbType.Guid, model.IntentionId);
            db.AddInParameter(dbCommand, "bContracted", DbType.Boolean, model.bContracted);
            db.AddInParameter(dbCommand, "ContractId", DbType.Guid, model.ContractId);
            db.AddInParameter(dbCommand, "ContractCode", DbType.AnsiString, model.ContractCode);
            db.AddInParameter(dbCommand, "IntentionCode", DbType.AnsiString, model.IntentionCode);
            db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, model.CreateDate);
            db.AddInParameter(dbCommand, "CreateEmpId", DbType.Guid, model.CreateEmpId);
            db.AddInParameter(dbCommand, "CreateEmp", DbType.AnsiString, model.CreateEmp);
            db.AddInParameter(dbCommand, "BelongCityId", DbType.Guid, model.BelongCityId);
            db.AddInParameter(dbCommand, "BelongCityName", DbType.AnsiString, model.BelongCityName);
            db.AddInParameter(dbCommand, "BelongCompanyId", DbType.Guid, model.BelongCompanyId);
            db.AddInParameter(dbCommand, "BelongCompany", DbType.AnsiString, model.BelongCompany);
            db.AddInParameter(dbCommand, "BelongDepartId", DbType.Guid, model.BelongDepartId);
            db.AddInParameter(dbCommand, "BelongDepart", DbType.AnsiString, model.BelongDepart);
            db.AddInParameter(dbCommand, "BelongEmpId", DbType.Guid, model.BelongEmpId);
            db.AddInParameter(dbCommand, "BelongEmp", DbType.AnsiString, model.BelongEmp);
            db.AddInParameter(dbCommand, "DeliverTime", DbType.DateTime, model.DeliverTime);
            db.AddInParameter(dbCommand, "LastEmployeeId", DbType.Guid, model.LastEmployeeId);
            db.AddInParameter(dbCommand, "LastEmployee", DbType.AnsiString, model.LastEmployee);
            db.AddInParameter(dbCommand, "LastEmployeeGetTime", DbType.DateTime, model.LastEmployeeGetTime);
            db.AddInParameter(dbCommand, "BusinessType", DbType.Int32, model.BusinessType);
            db.AddInParameter(dbCommand, "IntentionType", DbType.Int32, model.IntentionType);
            db.AddInParameter(dbCommand, "UpdateEmpId", DbType.Guid, model.UpdateEmpId);
            db.AddInParameter(dbCommand, "UpdateEmp", DbType.AnsiString, model.UpdateEmp);
            db.AddInParameter(dbCommand, "UpdateTime", DbType.DateTime, model.UpdateTime);
            db.AddInParameter(dbCommand, "Status", DbType.Int32, model.Status);
            db.AddInParameter(dbCommand, "StatusDescription", DbType.AnsiString, model.StatusDescription);
            db.AddInParameter(dbCommand, "HouseId", DbType.Guid, model.HouseId);
            db.AddInParameter(dbCommand, "HouseCode", DbType.AnsiString, model.HouseCode);
            db.AddInParameter(dbCommand, "HouseAddress", DbType.AnsiString, model.HouseAddress);
            db.AddInParameter(dbCommand, "Region", DbType.AnsiString, model.Region);
            db.AddInParameter(dbCommand, "TotalPrice", DbType.Decimal, model.TotalPrice);
            db.AddInParameter(dbCommand, "CustomerName_Sale", DbType.AnsiString, model.CustomerName_Sale);
            db.AddInParameter(dbCommand, "CustomerName_Buy", DbType.AnsiString, model.CustomerName_Buy);
            db.AddInParameter(dbCommand, "FirstMoney", DbType.Decimal, model.FirstMoney);
            db.AddInParameter(dbCommand, "TotalMoney", DbType.Decimal, model.TotalMoney);
            db.AddInParameter(dbCommand, "GetedMoney", DbType.Decimal, model.GetedMoney);
            db.AddInParameter(dbCommand, "DeliveredMoney", DbType.Decimal, model.DeliveredMoney);
            db.AddInParameter(dbCommand, "LastContractDate", DbType.DateTime, model.LastContractDate);
            db.AddInParameter(dbCommand, "LastDeliverMoneyDate", DbType.DateTime, model.LastDeliverMoneyDate);
            db.AddInParameter(dbCommand, "DeliverTo", DbType.Int32, model.DeliverTo);
            db.AddInParameter(dbCommand, "LostItems", DbType.AnsiString, model.LostItems);
            db.AddInParameter(dbCommand, "GetAuthorizeDate", DbType.DateTime, model.GetAuthorizeDate);
            db.AddInParameter(dbCommand, "ChangeTime", DbType.DateTime, model.ChangeTime);
            db.ExecuteNonQuery(dbCommand);

        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public static void Delete(Guid IntentionId)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from t_Intention_BaseInfo ");
            strSql.Append(" where IntentionId=@IntentionId ");
            Database db = DatabaseFactory.CreateDatabase("Chenxin_Business");
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "IntentionId", DbType.Guid, IntentionId);
            db.ExecuteNonQuery(dbCommand);

        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public static Chenxin.Lib.Business.Entity.IntentionBaseInfo GetModel(Guid IntentionId)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select IntentionId,bContracted,ContractId,ContractCode,IntentionCode,CreateDate,CreateEmpId,CreateEmp,BelongCityId,BelongCityName,BelongCompanyId,BelongCompany,BelongDepartId,BelongDepart,BelongEmpId,BelongEmp,DeliverTime,LastEmployeeId,LastEmployee,LastEmployeeGetTime,BusinessType,IntentionType,UpdateEmpId,UpdateEmp,UpdateTime,Status,StatusDescription,HouseId,HouseCode,HouseAddress,Region,TotalPrice,CustomerName_Sale,CustomerName_Buy,FirstMoney,TotalMoney,GetedMoney,DeliveredMoney,LastContractDate,LastDeliverMoneyDate,DeliverTo,LostItems,GetAuthorizeDate,ChangeTime from t_Intention_BaseInfo ");
            strSql.Append(" where IntentionId=@IntentionId ");
            Database db = DatabaseFactory.CreateDatabase("Chenxin_Business_Search");
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "IntentionId", DbType.Guid, IntentionId);
            Chenxin.Lib.Business.Entity.IntentionBaseInfo model = null;
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                }
            }
            return model;
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public static DataSet GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select IntentionId,bContracted,ContractId,ContractCode,IntentionCode,CreateDate,CreateEmpId,CreateEmp,BelongCityId,BelongCityName,BelongCompanyId,BelongCompany,BelongDepartId,BelongDepart,BelongEmpId,BelongEmp,DeliverTime,LastEmployeeId,LastEmployee,LastEmployeeGetTime,BusinessType,IntentionType,UpdateEmpId,UpdateEmp,UpdateTime,Status,StatusDescription,HouseId,HouseCode,HouseAddress,Region,TotalPrice,CustomerName_Sale,CustomerName_Buy,FirstMoney,TotalMoney,GetedMoney,DeliveredMoney,LastContractDate,LastDeliverMoneyDate,DeliverTo,LostItems,GetAuthorizeDate,ChangeTime ");
            strSql.Append(" FROM t_Intention_BaseInfo ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            Database db = DatabaseFactory.CreateDatabase("Chenxin_Business_Search");
            return db.ExecuteDataSet(CommandType.Text, strSql.ToString());
        }

        /// <summary>
        /// 对象实体绑定数据
        /// </summary>
        public static Chenxin.Lib.Business.Entity.IntentionBaseInfo ReaderBind(IDataReader dataReader)
        {
            Chenxin.Lib.Business.Entity.IntentionBaseInfo model = new Chenxin.Lib.Business.Entity.IntentionBaseInfo();
            object ojb;
            ojb = dataReader["IntentionId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.IntentionId = new Guid(ojb.ToString());
            }
            ojb = dataReader["bContracted"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.bContracted = (bool)ojb;
            }
            ojb = dataReader["ContractId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.ContractId = new Guid(ojb.ToString());
            }
            model.ContractCode = dataReader["ContractCode"].ToString();
            model.IntentionCode = dataReader["IntentionCode"].ToString();
            ojb = dataReader["CreateDate"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.CreateDate = (DateTime)ojb;
            }
            ojb = dataReader["CreateEmpId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.CreateEmpId = new Guid(ojb.ToString());
            }
            model.CreateEmp = dataReader["CreateEmp"].ToString();
            ojb = dataReader["BelongCityId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.BelongCityId = new Guid(ojb.ToString());
            }
            model.BelongCityName = dataReader["BelongCityName"].ToString();
            ojb = dataReader["BelongCompanyId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.BelongCompanyId = new Guid(ojb.ToString());
            }
            model.BelongCompany = dataReader["BelongCompany"].ToString();
            ojb = dataReader["BelongDepartId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.BelongDepartId = new Guid(ojb.ToString());
            }
            model.BelongDepart = dataReader["BelongDepart"].ToString();
            ojb = dataReader["BelongEmpId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.BelongEmpId = new Guid(ojb.ToString());
            }
            model.BelongEmp = dataReader["BelongEmp"].ToString();
            ojb = dataReader["DeliverTime"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.DeliverTime = (DateTime)ojb;
            }
            ojb = dataReader["LastEmployeeId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.LastEmployeeId = new Guid(ojb.ToString());
            }
            model.LastEmployee = dataReader["LastEmployee"].ToString();
            ojb = dataReader["LastEmployeeGetTime"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.LastEmployeeGetTime = (DateTime)ojb;
            }
            ojb = dataReader["BusinessType"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.BusinessType = (int)ojb;
            }
            ojb = dataReader["IntentionType"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.IntentionType = (int)ojb;
            }
            ojb = dataReader["UpdateEmpId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.UpdateEmpId = new Guid(ojb.ToString());
            }
            model.UpdateEmp = dataReader["UpdateEmp"].ToString();
            ojb = dataReader["UpdateTime"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.UpdateTime = (DateTime)ojb;
            }
            ojb = dataReader["Status"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Status = (int)ojb;
            }
            model.StatusDescription = dataReader["StatusDescription"].ToString();
            ojb = dataReader["HouseId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.HouseId = new Guid(ojb.ToString());
            }
            model.HouseCode = dataReader["HouseCode"].ToString();
            model.HouseAddress = dataReader["HouseAddress"].ToString();
            model.Region = dataReader["Region"].ToString();
            ojb = dataReader["TotalPrice"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.TotalPrice = (decimal)ojb;
            }
            model.CustomerName_Sale = dataReader["CustomerName_Sale"].ToString();
            model.CustomerName_Buy = dataReader["CustomerName_Buy"].ToString();
            ojb = dataReader["FirstMoney"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.FirstMoney = (decimal)ojb;
            }
            ojb = dataReader["TotalMoney"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.TotalMoney = (decimal)ojb;
            }
            ojb = dataReader["GetedMoney"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.GetedMoney = (decimal)ojb;
            }
            ojb = dataReader["DeliveredMoney"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.DeliveredMoney = (decimal)ojb;
            }
            ojb = dataReader["LastContractDate"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.LastContractDate = (DateTime)ojb;
            }
            ojb = dataReader["LastDeliverMoneyDate"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.LastDeliverMoneyDate = (DateTime)ojb;
            }
            ojb = dataReader["DeliverTo"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.DeliverTo = (int)ojb;
            }
            model.LostItems = dataReader["LostItems"].ToString();
            ojb = dataReader["GetAuthorizeDate"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.GetAuthorizeDate = (DateTime)ojb;
            }
            ojb = dataReader["ChangeTime"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.ChangeTime = (DateTime)ojb;
            }
            return model;
        }

        #endregion  成员方法
    }
}

